﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using DevComponents.Instrumentation;

namespace IntelliTouchMix
{
    public partial class Deck : Form
    {
        private Color[] _Colors = { Color.Aqua, Color.Lime, Color.Yellow, Color.Orange, Color.Red };
//        private Color[] _Colors = { Color.ForestGreen, Color.Lime, Color.Yellow, Color.Orange, Color.Red };
        private float[] _Positions = { 0f, .25f, .3f, .6f, 1f };

        public Int16 player = 0;

        public Deck(Int16 player)
        {
            this.player = player;
            InitializeComponent();
            this.volume.PreRenderScalePointer += new System.EventHandler<DevComponents.Instrumentation.PreRenderScalePointerEventArgs>(this.GcLinear8PreRenderScalePointer);
        }

        private void DeckA_Load(object sender, EventArgs e)
        {

            panelWave.Select();
        }

        private void gcLinear8_Click(object sender, EventArgs e)
        {
           // gcLinear8.
        }
        private void GcLinear8PreRenderScalePointer(object sender, PreRenderScalePointerEventArgs e)
        {
             GraphicsPath path = e.Pointer.GetPointerPath();

             if (path != null)
             {
                 Rectangle r = e.Pointer.Scale.Bounds;

                 using (LinearGradientBrush br =
                     new LinearGradientBrush(r, Color.White, Color.White, -90))
                 {
                     ColorBlend cb = new ColorBlend(_Colors.Length);
                     cb.Colors = _Colors;
                     cb.Positions = _Positions;

                     br.InterpolationColors = cb;

                     e.Graphics.FillPath(br, path);
                 }

                 // Tell the system to cancel its rendering, since
                 // we just rendered the contents of the pointer

                 e.Cancel = true;
             }
        }

        private void gcLinear8_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("value "  + volume.GetPointerValue("Bar1"));
            
        }

        private void switchMonitor_ValueChanged(object sender, EventArgs e)
        {
            Util.formMain.switchMasterMonitor(player,((DevComponents.DotNetBar.Controls.SwitchButton)sender).Value);
        }
        private void panelEx1_Click(object sender, EventArgs e)
        {
            Util.deSelectAll();
            Activate();
            Focus();
            panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2000;
            Refresh();
            if (Util.deckA.panelEx1.ColorSchemeStyle == panelEx1.ColorSchemeStyle)
            {
                Util.selectedPanel = Util.DECK_A;
                Console.WriteLine("Selected Panel:" + Util.selectedPanel);
                Util.formaPrincipal.touchController.ControlSense(Util.selectedPanel);
                
            }
            else if(Util.deckB.panelEx1.ColorSchemeStyle == panelEx1.ColorSchemeStyle)
            {
                Util.selectedPanel = Util.DECK_B;
                Console.WriteLine("Selected Panel:" + Util.selectedPanel);
                Util.formaPrincipal.touchController.ControlSense(Util.selectedPanel);
            }
          //  if(
          //  Util.formaPrincipal.touchController.
        }

    }
}
